package game_engine.menu;

import game_engine.core.Vector2f;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import org.newdawn.slick.TrueTypeFont;


public abstract class MenuItem {

	
	private String value;
	protected String name;
//	private static int id;
	protected Vector2f position ;
	protected TrueTypeFont font;
	
	private ArrayList<ActionListener> listeners;
	
	protected boolean selected = false;
	
	public MenuItem(String name, Vector2f position, TrueTypeFont font) {
		this.name = name;
		this.position = position;
		this.font = font;
		listeners = new ArrayList<ActionListener>();
	}
	
	public abstract void render();
	
	public boolean isSelected() {
		return selected;
	}
	
	public void setSelected(boolean selected) {
		this.selected = selected;
	}
	
	public String getValue() {
		return value;
	}
	
	public void setValue(String value) {
		this.value = value;
	}
	
	public boolean addActionListener(ActionListener listener) {
		return listeners.add(listener);
	}
	
	public boolean removeActionListener(ActionListener listener) {
		return listeners.remove(listener);
	}
	
	public void actionPerformed() {
		for(ActionListener l : listeners) l.actionPerformed(new ActionEvent(this, 0, "actionMenu"));
	}
}
